<?php

class Calendar extends Module
{
	function __construct ($db){
		$this->set_db($db);
	}

	function get_all_event(){
		return $this->get_all("calendar");
	}

	function get_event($id){
		return $this->get("calendar", "id = $id");
	}

	function get_range_date($from, $to){

		$sql = "SELECT * FROM calendar WHERE start_date >= '$from' and stop_date <= '$to'";
		$rss = $this->db->query($sql);

		$result = array();

		while($line = $this->db->fetchNextObject($rss)){

			$tmp = $this->fetch($line);
			/*
			$tmp['wday'] =  date("D", strtotime($line->date));
			$tmp['day'] =  date("d", strtotime($line->date));
			$tmp['month'] = strtoupper(date("M", strtotime($line->date)));
			*/
			array_push($result, $tmp);
		}
		return $result;
	}
}

?>